<template>
  <div class="common-table-head common-jus-bet">
    <div class="common-flex">
      <div class="common-flex mr20 head-select">
        <div class="select-label">
          状态:
        </div>
        <el-select
          v-model="queryObj.status"
          placeholder="请选择状态"
          clearable
          @change="handleSearch"
        >
          <el-option
            v-for="item in statusList"
            :key="item.status"
            :label="item.name"
            :value="item.status"
          />
        </el-select>
      </div>

      <div class="common-flex mr20 head-select">
        <div class="select-label">
          分类名称:
        </div>
        <el-input
          v-model="queryObj.name"
          placeholder="请输入搜索内容"
          width="2000"
          clearable
        />
      </div>
    </div>

    <div class="header-buttons">
      <el-button type="success" @click="handleSearch">
        搜索
      </el-button>
      <el-button
        type="primary"
        @click="dialogOpen"
      >
        新增
      </el-button>
    </div>
  </div>
</template>

<script>
export default {
  name: 'CategoryHeadSearch',
  props: {
    queryObj: {
      type: Object,
      default: () => {
        return {
          pageSize: 10,
          pageNum: 1,
          title: '',
          status: ''
        }
      }
    },
    statusList: {
      type: Array,
      default: () => []
    }
  },
  methods: {
    handleSearch() {
      this.$emit('update:queryObj', this.queryObj)
      this.$emit('handleSearch')
    },
    dialogOpen() {
      this.$emit('dialogOpen')
    }
  }
}
</script>

<style lang="scss" scoped>
.select-is {
  width: 15%;
}
.head-flex {
  flex: 1;
}
</style>
